cmake_minimum_required(VERSION 2.8)

SET(PRJ_NAME 				nid)
SET(PRJ_ROOTDIR				${CMAKE_CURRENT_SOURCE_DIR} )
PROJECT(${PRJ_NAME} 		C CXX)

INCLUDE_DIRECTORIES( 
	"${PRJ_ROOTDIR}"
	"${PRJ_ROOTDIR}/nid"
)

LINK_DIRECTORIES( 
	"${PRJ_ROOTDIR}/build"
)

## 定义源文件集合：指定子目录下所有的*.c
FILE(GLOB_RECURSE nid_sources RELATIVE ${PRJ_ROOTDIR} "nid/*.c")

SET(cflags	-std=gnu99)
ADD_DEFINITIONS(${cflags})

ADD_LIBRARY(nid_static STATIC ${nid_sources})
ADD_LIBRARY(nid SHARED ${nid_sources})

ADD_EXECUTABLE(test  
	# ${nid_sources}  # 使用源文件集合
	${PRJ_ROOTDIR}/test.c 
)

target_link_libraries(test 
	nid
)